import { setCommonFunc } from '@/redux/slices/commonFuns';
import { createSlice } from '@reduxjs/toolkit';
// import request from '@request';

const jobSlice = createSlice({
  name: 'job',
  initialState: {
    sectionDomArr: [],
    page_index: 0,
  },
  reducers: {
    setCommon: (state, { payload }) => {
      if (Object.prototype.toString.call(payload) === '[object Object]' && Object.keys(payload).length > 0) {
        for (const item in payload) {
          state[item] = payload[item];
        }
      } else {
        throw Error('payload must be an object!');
      }
    }
  }
});

export const { setCommon } = jobSlice.actions;
export default jobSlice.reducer;
